import type { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/home',
    component: () => import('@/views/Home/index.vue'),
    children: [
      {
        path: 'message',
        component: () => import('@/views/Message/index.vue'),
        children: [
          {
            name: 'MsgDetail',
            path: 'msgdetail/:msgId?',
            component: () => import('@/views/MsgDetail/index.vue'),
            props(route) {
              return {
                msgId: route.params.msgId,
                content: route.query.content,
                text: '你是个好人'
              }
            }
          }
        ]
      },
      {
        path: 'news',
        component: () => import('@/views/News/index.vue'),
        children: [
          {
            name: 'NewsDetail',
            path: 'newsdetail/:newsId?',
            component: () => import('@/views/NewsDetail/index.vue')
          }
        ]
        
      },
      {
        path: '',
        redirect: '/home/message'  //二级路由redirect不支持简写
      },
    ]
  },
  {
    path: '/about',
    component: () => import('@/views/About/index.vue')
  },
  {
    path: '/',
    redirect: '/home'  
  },
  
  
]


export default routes